import { Entity, Column, PrimaryGeneratedColumn, BaseEntity } from 'typeorm';

@Entity("member", { synchronize: true })
export class Member extends BaseEntity {

    @PrimaryGeneratedColumn({ type: 'bigint', comment: '用户ID' })
    user_id!: number;

    @Column({ type: 'varchar', nullable: true, length: 30, comment: '用户账号' })
    user_name: string = '';

    @Column({ type: 'varchar', length: 30, comment: '用户昵称' })
    nick_name!: string;

    @Column({ type: 'varchar', nullable: true, length: 2, comment: '用户类型（00系统用户）', default: '00' })
    user_type: string = '00';

    @Column({ type: 'varchar', nullable: true, length: 50, comment: '用户邮箱', default: '' })
    email: string = '';

    @Column({ type: 'varchar', length: 11, comment: '手机号码', default: '' })
    phonenumber!: string;

    @Column({ type: 'char', nullable: true, length: 1, comment: '用户性别（0男 1女 2未知）', default: '0' })
    sex: string = '0';

    @Column({ type: 'varchar', nullable: true, length: 200, comment: '头像地址', default: '' })
    avatar: string = '';

    @Column({ type: 'varchar', length: 100, comment: '密码', default: '' })
    password!: string;

    @Column({ type: 'char', nullable: true, length: 1, comment: '帐号状态（0正常 1停用）', default: '0' })
    status: string = '0';

    @Column({ type: 'char', nullable: true, length: 1, comment: '删除标志（0代表存在 2代表删除）', default: '0' })
    del_flag: string = '0';

    @Column({ type: 'varchar', nullable: true, length: 128, comment: '最后登录IP', default: '' })
    login_ip: string = '';

    @Column({ type: 'datetime', nullable: true, comment: '最后登录时间' })
    login_date?: Date | null = null;

    @Column({ type: 'varchar', nullable: true, length: 64, comment: '创建者', default: '' })
    create_by: string = '';

    @Column({ type: 'datetime', nullable: true, comment: '创建时间' })
    create_time?: Date | null = null;

    @Column({ type: 'varchar', nullable: true, length: 64, comment: '更新者', default: '' })
    update_by: string = '';

    @Column({ type: 'datetime', nullable: true, comment: '更新时间' })
    update_time?: Date | null = null;

    @Column({ type: 'varchar', length: 500, nullable: true, comment: '备注', default: '' })
    remark?: string;

    @Column({ type: 'varchar', length: 255, nullable: true, comment: '手机端token-key' })
    app_key?: string;

    @Column({ type: 'int', nullable: true, comment: '序列号' })
    serial_num?: number;

    @Column({ type: 'varchar', length: 30, nullable: true, comment: '推广码' })
    spread_no?: string;

    @Column({ type: 'varchar', length: 255, nullable: true, comment: '代理层级' })
    path?: string;

    @Column({ type: 'bigint', nullable: true, comment: '推荐人' })
    spread_id?: number;

    @Column({ type: 'int', nullable: true, comment: '代理等级', default: 0 })
    level_id: number = 0;
}